package com.y4oung.service.impl;

import com.y4oung.dao.IReviewDao;
import com.y4oung.model.Review;
import com.y4oung.service.IReviewService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.Date;
import java.util.List;

@Service("reviewService")
public class ReviewServiceImpl implements IReviewService {

    @Resource
    private IReviewDao ReviewDao;
    Review review = new Review();

    public List<Review> showReviewList(int id){
        return ReviewDao.showReviewList(id);
    }

    public void writeReview(int business_id, int user_id, float stars, float taste, float service, float environment, Date date, String text){
        review.setBusinessId(business_id);
        review.setUserId(user_id);
        review.setStars(stars);
        review.setTaste(taste);
        review.setService(service);
        review.setEnvironment(environment);
        review.setDate(date);
        review.setText(text);

        ReviewDao.writeReview(review);
    }
}
